package com.act;

import android.content.Context;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;

/**
 * 推送的Notification 设置界面
 * 
 * @author Administrator
 *
 */
public class NotificationSettingActivity extends PreferenceActivity {

	private static final String TAG = LogUtil.getClassName(NotificationSettingActivity.class);
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.setPreferenceScreen(createPreferenceScreen());
	}

	private PreferenceScreen createPreferenceScreen()
	{
		PreferenceManager preManager = getPreferenceManager();
		preManager.setSharedPreferencesName(Constants.SET_NOTIFICATION_NAME);
		preManager.setSharedPreferencesMode(Context.MODE_PRIVATE);
		
		PreferenceScreen preScreen = preManager.createPreferenceScreen(this);
		
		CheckBoxPreference notifyCheckBox = new CheckBoxPreference(this);
		notifyCheckBox.setKey(Constants.SET_NOTIFICATION_ENABLE);
		notifyCheckBox.setDefaultValue(Boolean.TRUE);
		notifyCheckBox.setTitle("推送开关");
		notifyCheckBox.setSummaryOff("推送关闭");
		notifyCheckBox.setSummaryOn("推送打开");
		
		CheckBoxPreference notifySound = new CheckBoxPreference(this);
		notifySound.setKey(Constants.SET_NOTIFICATION_SOUND);
		notifySound.setDefaultValue(Boolean.TRUE);
		notifySound.setTitle("声音开关");
		notifySound.setSummaryOff("声音提示关闭");
		notifySound.setSummaryOn("声音提示打开");
		
		CheckBoxPreference notifyVibrator = new CheckBoxPreference(this);
		notifyVibrator.setKey(Constants.SET_NOTIFICATION_VIBRATOR);
		notifyVibrator.setDefaultValue(Boolean.TRUE);
		notifyVibrator.setTitle("震动开关");
		notifyVibrator.setSummaryOff("震动提示关闭");
		notifyVibrator.setSummaryOn("震动提示打开");
		
		preScreen.addPreference(notifyCheckBox);
		preScreen.addPreference(notifySound);
		preScreen.addPreference(notifyVibrator);
		
		return preScreen;
	}
	
}
